package
{
	import com.ascainiao3d.display.Cube3D;
	import com.ascainiao3d.display.World3D;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class ascainiao3d extends Sprite
	{
		private var cube:Cube3D=new Cube3D(200,0xffffff);
		private var world:World3D;
		private var _vpx:Number;
		private var _vpy:Number;
		public function ascainiao3d()
		{
			_vpx=stage.stageWidth / 2;
			_vpy=stage.stageHeight / 2;
			world=new World3D(_vpx,_vpy);
			addChild(world);
			world.addObject3D(cube);
			//world.light=
			world.rendering();
			this.addEventListener(Event.ENTER_FRAME,onEnterFrame);
		}
		private function onEnterFrame(event:Event):void
		{
			var angleX:Number = (mouseY - _vpy) * .001;
			var angleY:Number = (mouseX - _vpx) * .001;
			cube.rotateX(angleX);
			cube.rotateY(angleY);
			world.rendering();
			//trace(angleX/Math.PI*180,angleY/Math.PI*180);
		}
	}
}